<template>
  <div class="time-container" v-loading="loading">
    <div class="title">
      <p class="big-title">柚子时光</p>
      <p class="en-title"><span>{{userInfo.nickname}}</span>&nbsp;已来到小柚智汇&nbsp;<span>{{userInfo.time}}</span>&nbsp;天，累计发布柚记&nbsp;<span>{{userInfo.total}}</span>&nbsp;篇</p>
    </div>
     <el-divider><i class="el-icon-timer"></i></el-divider>
    <div v-if="lir.length !== 0" class="block" >
      <el-timeline >
        <el-timeline-item  v-for="(item, index) in liste" :key="index" icon="el-icon-star-on" color="orange" size="large" :timestamp="index.slice(0,10)" placement="top">
          <el-tooltip effect="light" content='请到"柚子小组"中查看详情，该页面只做展示' placement="right">
            <el-card v-for="(card, index) in item " :key="index" @click="open">
              <img :src="card.url">
              <h4>{{card.title}}</h4>
              <el-tag type="success">{{card.tag}}</el-tag>
              <el-tag class="source" type="info">{{card.source}}</el-tag>
            </el-card>
          </el-tooltip>
        </el-timeline-item>
      </el-timeline>
    </div>
    <el-empty v-else :image-size="200"></el-empty>
  </div>
</template>

<script>
import { getAllTime } from '@/utils/api/time.js'
export default {
  name: '',
  components: {},
  props: {},
  data () {
    return {
      userInfo: {}, // 存储获取过来的信息
      liste: [],
      lir: [],
      loading: true
    }
  },
  created () {
    this.loadTime()
  },
  methods: {
    loadTime () {
      getAllTime().then(res => {
        this.userInfo = res.data.data
        this.lir = res.data.data
        this.liste = res.data.data.map
        this.loading = false
      })
    }
  }
}
</script>

<style lang="less" scoped>
.title{
    position: relative;
    top: -20px;
    p{
      text-align: center;
    }
    .big-title{
      font-size: 34px;
      margin-bottom: 10px;
      position: relative;
      }
     span{
        font-size: 20px;
        color: #f59b32;
      }
  .big-title::before,.big-title::after{
        content: '';
        display: inline-block;
        width: 20px;
        height: 1px;
        background-color: #000;
        position: absolute;
        top: 20px;
      }
    .big-title::before{
      left: 50%;
      transform: translate(-102px, 0);
    }
    .big-title::after{
        right: 50%;
        transform: translate(102px, 0);
      }
    }
    .el-divider__text, .el-link{
      font-size: 26px;
    }.el-divider{
      background-color: #e4e4e4;
    }
.block{
  /deep/.el-timeline-item__node--large{
    left: -5px;
    width: 20px;
    height: 20px;
  }
  /deep/.el-timeline-item__tail{
    border-left: 2px solid #f59b32;
  }
  .el-card{
    width: 200px;
    height: 200px;
    margin: 2%;
    display: inline-block;
    border-radius: 10px;
    background-color: #fdf0df;
    img{
      width: 100%;
      height: 130px;
    }
    h4{
      line-height: 0px;
      margin-left: 20px;
    }
    .el-tag{
      margin: 0 2px;
      box-shadow: 0 0 10px #ddd;
      height: 25px;
      line-height: 25px;
      margin-left: 8px;
    }
    .source{
      border: none;
    }
  }
  .el-card:hover{
     box-shadow:
               inset 6px 6px 20px rgba(0, 0, 0, 0.05);
    transform: scale(0.98);
    cursor: pointer;
                border:2px solid gray;
                background: lemonchiffon;
                box-shadow: 0 0 2px 2px rgba(255,255,255,0.4);
}
  /deep/.el-card__body{
    padding: 0;
  }
}
</style>
